package com.sy.interceptor;

import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.Interceptor;

public class MyInterceptor implements Interceptor {

	private static final long serialVersionUID = -7616483646376766435L;

	private String hello;
	public void destroy() {

		System.out.println("destory");
	}

	public void init() {//仅执行一次

		System.out.println("init");
		System.out.println(hello);
	}

	public String intercept(ActionInvocation invocation) throws Exception {
		
		System.out.println("intercept");
		
		String result=invocation.invoke();//判断是否还有下一个拦截器
		
		System.out.println("finish");
		
		return result;
	}

	public String getHello() {
		return hello;
	}

	public void setHello(String hello) {
		this.hello = hello;
	}

}
